package cn.ikun.xk.JDBC;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class AppJdbcInsert {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/baga?useSSL=false";
        String username = "root";
        String password = "xk20011216";
        Connection connection = DriverManager.getConnection(url, username, password);


        //3、创建陈述句对象
        Statement statement = connection.createStatement();

        String sql = "INSERT INTO `jk_user` (`username`, `password`) VALUES ('77tom', MD5('1023')),('bag',MD5('312321'));";
        // 执行 update 语句，得到受影响的行数
        int i = statement.executeUpdate(sql);
        if (i > 0) {
            System.out.println("插入成功！");
        }

    }
}
